package objReader;

import java.awt.Color;

import org.newdawn.slick.opengl.Texture;

public class Material 
{
	/* RGBA values */
	float R;
	float G;
	float B;
	float A;
	private Texture texture;
    private String name; /* The name of the material */
	boolean usesTexture;
	
	public Material(String name)
	{
		this.name = name;
		this.texture = null;
		this.usesTexture = false;
	}
	
	public Material(float r, float g, float b, float a, String name)
	{
		this(name);
		setColor(r, g, b, a);
	}
	
	public Material(Texture texture, String name)
	{
		this.texture = texture;
		this.name = name;
	}
	
	public Color getColor()
	{
		return (new Color(R, G, B, A));
	}
	
	public void setColor(Color newColor)
	{
		R = newColor.getRed();
		G = newColor.getGreen();
		B = newColor.getBlue();
		A = newColor.getAlpha();
	}
	
	public void setTexture(Texture texture)
	{
		if(texture != null)
		{
			this.texture = texture;
			usesTexture = true;
		}
		else
		{
			this.texture = null;
			usesTexture = false;
		}
	}
	
	public Texture getTexture()
	{
		return this.texture;
	}
	
	public String getName()
	{
		return name;
	}	
	
	public void setColor(float r, float g, float b, float a)
	{
		R = r;
		G = g;
		B = b;
		A = a;
	}
	
	public void setRed(float r)
	{
		R = r;
	}
	
	public void setBlue(float b)
	{
		B = b;
	}
	
	public void setGreen(float g)
	{
		G = g;
	}
	
	public void setAlpha(float a)
	{
		A = a;
	}
}
